
/*
 * @Author: qsy
 * @Date: 2024-07-23 14:44:24
 * @LastEditors: qsy
 * @LastEditTime: 2025-04-06 14:07:52
 * @Description: mqtt头文件
 */

// 头文件格式
#ifndef MY_MQTT_H
#define MY_MQTT_H

#include <stdio.h>
#include <stdint.h>
#include <stddef.h>
#include <string.h>
#include "esp_system.h"
#include "nvs_flash.h"
#include "esp_event.h"
#include "esp_netif.h"
// #include "protocol_examples_common.h"

#include "esp_log.h"
#include "mqtt_client.h"
#include "esp_tls.h"
// #include "esp_ota_ops.h"
#include <sys/param.h>
#include <driver/gpio.h>
#include <cJSON.h>
#include "wifi_connect.h"



#define URL_TEST "mqtt://broker.emqx.io:1883"
#define MQTT_PORT 1883 // 端口


#define DEVICE_ID "device1" // 设备ID
#define MQTT_SUB_TOPIC "my_device_sub/qsy/%s" // 订阅主题
#define MQTT_PUB_TOPIC "my_device_send/qsy/%s" // 发布主题


extern esp_mqtt_client_handle_t client;

void mqtt_app_start(void); // 启动mqtt
// void mtqq_start(void); // 测试
void mqtt_app_stop(void);

#endif